<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link type="text/css" rel="stylesheet" href="/css/bootstrap.min.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<title>Z盘</title>
<style type="text/css">
html, body {
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

#box {
	width: 100%;
}

#header {
	position: absolute;
	top: 0;
	left: 0;
}

#content {
	top: 51px;
	bottom: 21px;
	position: absolute;
	z-index: 1;
	left: 0;
	width: 100%;
}

#footer {
	height: 20px;
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	background-color: #f1f1f1;
	border-top: 1px solid #c1c1c1;
}

#footer-left {
	padding-left: 1em;
}

#footer-center {
	text-align: center;
}

#footer-right {
	padding-right: 1em;
	text-align: right;
}

#if {
	border: 0px;
}
</style>
<script>
	$(function() {
		$.ajax({
			url : "",
			type : "post",
			contentType : "application/json;charset=UTF-8",
			dataType : "json",
			success : function(data) {
				if (data.code == 0) {
					var d = data.data;
					var account = d.account;
					var link = d.link;
					var jump = d.jump;
					if (account == null) {
						$("#isLogin").remove();
					} else {
						$("#notLogin").remove();
						$("#userAccount").text(account);
						if (account.toLowerCase() != "admin") {
							$("#isAdmin").remove();
						}
					}
					if (link != null) {
						$("#if").attr("src", link);
					}
					if (jump != null) {
						$("#if").attr("src", jump);
					}
				}
			}
		});
	});
	function logout() {
		$.ajax({
			url : "/user/logout",
			type : "post",
			contentType : "application/json;charset=UTF-8",
			dataType : "json",
			success : function(data) {
				if (data.code == 0) {
					window.location.href = "/";
				}
			}
		});
	}
</script>
</head>
<body>
	<div id="box">
		<div id="header">
			<nav class="navbar navbar-default navbar-fixed-top">
				<div class="navbar-header">
					<a class="navbar-brand" href="/">Z盘</a>
				</div>
				<div class="collapse navbar-collapse" id="notLogin">
					<ul class="nav navbar-nav navbar-right">
						<li><a href="/user/login">登录</a></li>
						<li><a href="/user/register">注册&emsp;</a></li>
					</ul>
				</div>
				<div class="collapse navbar-collapse" id="isLogin">
					<ul class="nav navbar-nav">
						<li><a href="/user/user/file/info" target="if">我的主页</a></li>
						<li class="dropdown" id="isAdmin"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span>系统管理</span><strong class="caret"></strong></a>
							<ul class="dropdown-menu">
								<li><a href="/admin/realname" target="if">实名信息管理</a></li>
								<li><a href="/admin/user" target="if">用户信息管理</a></li>
								<li><a href="/admin/file" target="if">文件信息管理</a></li>
								<li><a href="/admin/historyDownload" target="if">下载记录管理</a></li>
								<li><a href="/admin/historyBrowsing" target="if">浏览记录管理</a></li>
								<li><a href="/admin/tipOff" target="if">举报记录管理</a></li>
							</ul></li>
					</ul>
					<ul class="nav navbar-nav navbar-right">
						<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span id="userAccount"></span><strong class="caret"></strong>&emsp;</a>
							<ul class="dropdown-menu">
								<li><a href="/user/changePwd" target="if">修改密码</a></li>
								<li><a href="/user/edit" target="if">修改信息</a></li>
								<li class="divider"></li>
								<li><a href="javascript:void(0);" onclick="logout()">退出</a></li>
							</ul></li>
					</ul>
				</div>
			</nav>
		</div>
		<div id="content">
			<iframe id="if" name="if" src="/file/search" width="100%" height="100%"></iframe>
		</div>
		<table id="footer">
			<tr>
				<td id="footer-left">
					<a href="/BSDLicense.txt" target="_blank">开源协议</a>
				</td>
				<td id="footer-center">
					<a href="https://icp.chinaz.com/%E6%A1%82ICP%E5%A4%8718011326%E5%8F%B7" target="_blank">桂ICP备18011326号</a>
				</td>
				<td id="footer-right">
					<a href="https://github.com/ali1416" target="_blank">ali1416@GitHub</a>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
